// inherits

var util = require('util');

function Base() {
	this.name = 'tom';
	this.age = 1;
	this.say = function() {
		console.log('hi',this.name);
	};
}

Base.prototype.showName = function() {
	console.log(this.name);
}

function Child() {
	this.name = 'child';
}

// like java extend, be careful!! Child only extend Base.prototype‘s function
util.inherits(Child, Base);

var b = new Base();

b.showName();
b.say();

console.log(b);

var c = new Child();
c.showName();

console.log(c);

// convert object to string
console.log(util.inspect(b));
// pretty format
console.log(util.inspect(b, true));


console.log(util.isArray([]));

console.log(util.isRegExp(/xxx x/));
console.log(util.isRegExp(new RegExp('xxx')));

console.log(util.isDate(new Date()));
console.log(util.isDate({}));

